package com.four.hospital.service.impl;

import com.four.common.vo.UserTo;
import com.four.hospital.dao.FollowDao;
import com.four.hospital.dao.UserDao;
import com.four.hospital.entity.Follow;
import com.four.hospital.entity.User;
import com.four.hospital.service.FollowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author:wsy
 * @Date: 2022/01/17/15:10
 * @Description
 */
@Service
public class FollowServiceImpl implements FollowService {

    @Autowired
    private FollowDao followDao;

    @Autowired
    private UserDao userDao;

    /**
     * 患者点击关注医生
     * @param userPhone
     * @param docId
     */
    @Override
    public void clickFollow(String userPhone, Integer docId) {
        //根据登录人手机号查询登录人信息
        UserTo user=userDao.getByPhone(userPhone);
        //讲登录人id和医生id添加进关注表
        Follow follow = new Follow();
        follow.setDocId(docId);
        follow.setUserId(user.getUserId());
        followDao.addFollow(follow);
    }
}
